/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simplemetrosystem.model.Command.EditCommand;

import simplemetrosystem.control.ElementManager;
import simplemetrosystem.model.Command.Command;
import simplemetrosystem.model.Element.MetroString;

/**
 *
 * @author Eric Qian
 */
public class EditStringCommand implements Command {

    public EditStringCommand(MetroString string, String text, int logX, int logY) {
        this.string = string;
        this.text = text;
        this.logX = logX;
        this.logY = logY;
        tText = string.getName();
        tLogX = string.getLogX();
        tLogY = string.getLogY();
    }

    public void execute() {
        ElementManager.getInstance().editString(string, text, logX, logY);
    }

    public void undo() {
        ElementManager.getInstance().editString(string, tText, tLogX, tLogY);
    }
    private MetroString string;
    private String text;
    private int logX;
    private int logY;
    private String tText;
    private int tLogX;
    private int tLogY;
}
